package test2;

/**
 * @Author Jun jie Yi
 * 2022/4/4 20:55
 */
public class RedBag {
    public static void main(String[] args) {
        //100元钱 10个红包 0.01 ~ (x / n) * 2
        double all = 1;
        int count = 20;
        for (int i = count; i >= 1; i--) {
            if (i == 1) {
                System.out.println(all);
                break;
            }
            double scope = all / count * 2;
            double val = Math.random() * scope;
            if (val < 0.01) {
                i++;
                continue;
            }
            System.out.println(val);
            all = all - val;
        }

        System.out.println();
    }
}
